# include <bits/stdc++.h>
using namespace std;
int t, n, m, L, V, d[114514], v[114514], a[114514], p[114514];


int speed(int v0, int v1, int a){
    return (v1 * v1 - v0 * v0) / (2 * a);
}

void cs(){
    int s = 0;
    for (int i = 1; i <= n; i++){
        int l = 0, r = 0;
        if (v[i] > V){
            l = d[i];
            if (a >= 0) r = L + 1;
            else{
                r = l + speed(v[i], V, a[i]);
            }
        }
        else{
            if (a <= 0) continue;
            else{
                l = d[i] + speed(v[i], V, a[i]);
                r = L + 1;
            }
        }
        for (int j = 1; j <= m; j++){
            if (p[j] >= l && p[j] <= r) s++;
        }
    }

}

int main(){
    freopen("detect.in", "r", stdin);
    freopen("detect.out", "w", stdout);
    cin >> t;
    for (int i = 1; i <= t; i++){
        memset(d, 0, sizeof(d));
        memset(v, 0, sizeof(v));
        memset(a, 0, sizeof(a));
        memset(p, 0, sizeof(p));
        cin >> n >> m >> L >> V;
        for (int j = 1; j <= n; j++){
            cin >> d[j] >> v[j] >> a[j];
        }
        for (int j = 1; j <= m; j++){
            cin >> p[j];
        }
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}
